import type { PageParams, PageResult } from '@/types/global'
import type { rechargeCenter, rechargeOrderListItem, rechargePlanParams } from '@/types/member'
import { request } from '@/utils/request'

export const getRechargeCenterApi = () => {
  return request<rechargeCenter>({
    method: 'GET',
    url: '/recharge/center',
  })
}

/**
 * 余额充值
 * @param data
 * @returns
 */
export const postRechargeApi = (data: rechargePlanParams) => {
  return request<WechatMiniprogram.RequestPaymentOption>({
    method: 'POST',
    url: '/recharge/recharge',
    data,
  })
}

/**
 * 获取充值订单列表
 * @param data
 * @returns
 */
export const getRechargeOrderListApi = (data: PageParams) => {
  return request<PageResult<rechargeOrderListItem[]>>({
    method: 'GET',
    url: '/recharge/orderList',
    data,
  })
}
